<template>
	<view>
		<view class="u-skeleton">
			<!-- 首页头部 -->
			<view class="header">
				<u-swiper :list="bannerList" height="556" mode="dot" interval="8000" @click="bannerClick"></u-swiper>
				
				<view class="label-box">
					<!-- 二维码猴head -->
					<view class="tow-ma" @click="getQrCode"></view>
					<view class="item u-skeleton-fillet">
						<view class="u-font-40"><text class="num">{{formatNumberWithTenThousand(statistics.weightTotal)}}</text></view>
						<view class="u-font-28 u-m-t-20"><text>回收重量(kg)</text></view>
					</view>
					<view class="border-line"></view>
					<view class="item u-skeleton-fillet">
						<view class="u-font-40"><text class="num">{{formatNumberWithTenThousand(statistics.incomeTotal) || 0}}</text></view>
						<view class="u-font-28 u-m-t-20"><text class="u-p-r-8">累计收益(元)</text></view>
					</view>
					<view class="border-line"></view>
					<view class="item u-skeleton-fillet">
						<view class="u-font-40"><text class="num">{{formatNumberWithTenThousand(statistics.integralTotal)}}</text></view>
						<view class="u-font-28 u-m-t-20"><text>碳积分</text></view>
					</view>
				</view>
			</view>
			<!-- 主体部分 -->
			<view class="main">
				<!-- 站点定位入口 -->
				<view class="men-box">
					<view class="go-box">
						<!-- 上门回收 -->
						<navigator class="l-box u-skeleton-fillet" open-type="switchTab" @click="goApply(0)">
							<view class="zi">上门回收</view>
							<view class="zi-two">
								小哥上门回收
							</view>
							<view class="flex-r">
								<image style="width: 160rpx;  height: 112rpx; margin-right: 25rpx;" :src="bg" mode="widthFix"></image>
							</view>
							<view class="describe">
								上门更省心
							</view>
						</navigator>
						<!-- 送到站点回收 -->
						<navigator class="l-box u-skeleton-fillet" open-type="switchTab" @click="goApply(1)">
							<view class="zi">
								自送
							</view>
							<view class="zi-two">
								送到站点回收
							</view>
							<view class="flex-r">
								<image style="width: 160rpx; height: 112rpx;  margin-right: 25rpx;" :src="bg1" mode="widthFix">
								</image>
							</view>
							<view class="describe l-15">
								自送价更高
							</view>
						</navigator>
					</view>
				</view>
				<!-- 显示公告 -->
				<view class="notice-bar">
					<view class="u-skeleton-fillet" style="box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1); border-radius: 20rpx;">
						<u-notice-bar mode="vertical" :is-circular="false" :list="list" :font-size="24">
						</u-notice-bar>
					</view>
				</view>
				<!-- 品类选择回收 -->
				<view class="grid-box mt">
					<u-grid :col="2" :border="false" align="left">
						<u-grid-item :custom-style="{alignItems: 'flex-start'}" v-for="(item,index) in chooseType"
							:key="item.id" @click="choose(item)">
							<view class="u-flex">
								<view class="text">
									<view class="t1 u-skeleton-rect"><text class="u-line-1">{{item.name}}</text></view>
									<view class="t2 u-skeleton-rect"><text class="u-line-1">{{item.brief}}</text></view>
								</view>
								<u-image width="70rpx" height="70rpx" :src="item.icon" class="u-m-r-25 u-skeleton-circle" shape="circle">
								</u-image>
							</view>
						</u-grid-item>
					</u-grid>
					<navigator url="/pages/apply/apply" open-type="switchTab" @click="gorecovery" class="u-btn bg-gradual-blue u-skeleton-fillet">一键上门回收</navigator>
				</view>
				<!-- 环保贡献 -->
				<view class="grid-box u-skeleton-fillet">
					<view class="head-title u-m-b-30">
						<view>
							<text>环保贡献 |</text>
							<text class="u-font-24 u-p-l-10">时尚分类 绿美清远</text>
						</view>
					</view>
					<view class="grid-style-box" @click="showTips = true">
						<view class="item t1">
							<view><text class="font bold">{{formatNumberWithTenThousand(carbonRanking.carbon*0.088)}}</text><text class="font u-font-20">棵</text></view>
							<view><text class="font u-font-24">减少砍伐</text></view>
							<image class="grid-img" src="" mode=""></image>
						</view>
						<view class="item t2 u-m-l-15 u-m-r-15">
							<view><text class="font bold">{{formatNumberWithTenThousand(carbonRanking.carbon)}}</text><text class="font u-font-20">吨</text></view>
							<view><text class="font u-font-24">减少碳排放</text></view>
							<image class="grid-img" src="" mode=""></image>
						</view>
						<view class="item t3">
							<view><text class="font bold">{{formatNumberWithTenThousand(carbonRanking.carbon*1.7)}}</text><text class="font u-font-20">平方</text></view>
							<view><text class="font u-font-24">保护土地</text></view>
							<image class="grid-img" src="" mode=""></image>
						</view>
					</view>
				</view>
				<view class="grid-box u-skeleton-fillet u-p-0" @click="goUnitList" style="overflow: hidden;">
					<!-- <view class="head-title u-m-b-30">
						<view>
							<text>党政企支持 |</text>
							<text class="u-font-24 u-p-l-10">双碳目标 两网融合</text>
						</view>
						<navigator url="../news/list/list"><text class="iconfont icon-gengduo more u-font-40"></text>
						</navigator>
					</view> -->
					<view style="position: relative;">
						<image :src="banner1" mode="widthFix" style="width: 695rpx;display: block;"></image>
						<view class="head-title u-m-b-30" style="position: absolute;top: 30rpx;left: 30rpx;display: block;background: #ffffffd4;padding: 5px 10px;">
							<view>
								<text class="u-font-40" style="color: #e21001;font-weight: bold;">党政企支持</text>
							</view>
							<view class="u-p-t-4">
								<text class="u-font-30">双碳目标 两网融合</text>
							</view>
							<view>
								<text class="u-font-24">建设生活垃圾分类“五进”工作进度</text>
							</view>
						</view>
					</view>
					<!-- <view class="grid-style-box2">
						<view class="item">
							<view class="con style1">
								<view><text class="t1">进机关</text></view>
								<view class="u-m-t-10"><text class="t2">{{sumEnterpriseByType[3].number}}+</text></view>
							</view>
						</view>
						<view class="item">
							<view class="con style2">
								<view><text class="t1">进客户组</text></view>
								<view class="u-m-t-10"><text class="t2">{{sumEnterpriseByType[0].number}}+</text></view>
							</view>
						</view>
						<view class="item">
							<view class="con style2">
								<view><text class="t1">进社区</text></view>
								<view class="u-m-t-10"><text class="t2">28+</text></view>
							</view>
						</view>
						<view class="item">
							<view class="con style1">
								<view><text class="t1">进学校</text></view>
								<view class="u-m-t-10"><text class="t2">{{sumEnterpriseByType[1].number}}+</text></view>
							</view>
						</view>
					</view> -->
					<!-- <view class="paiming-list u-p-t-10 u-p-b-10 u-p-l-30 u-p-r-30">
						<view class="item" v-for="(item,index) in carbonRanking.ranking" :key="index">
							<view>
								<image v-if="index == 0" class="ico" src="" mode=""></image>
								<image v-if="index == 1" class="ico" src="" mode=""></image>
								<image v-if="index == 2" class="ico" src="" mode=""></image>
							</view>
							<text class="u-flex-1">{{item.name}}</text>
							<view style="display: flex;align-items: center;">
								<text class="num">{{item.carbon}}</text>
								<text class="u-font-20">CO₂</text>
							</view>
						</view>
					</view> -->
				</view>
				<!-- “五进” -->
				<view class="grid-box u-skeleton-fillet u-p-0" style="overflow: hidden;" @click="goImgArr">
					<image :src="banner3" mode="widthFix" style="display: block;width: 100%;"></image>
				</view>
				<!-- <view class="grid-box u-skeleton-fillet" style="overflow: hidden;" @click="goImgArr">
					<view class="head-title u-m-b-30">
						<view>
							<text>建设生活垃圾分类“五进”工作进度</text>
						</view>
					</view>
					<view class="grid-style-box2">
						<view class="item">
							<view class="con style1">
								<view><text class="t1">进机关</text></view>
								<view class="u-m-t-10"><text class="t2">{{sumEnterpriseByType[3].number}}+</text></view>
							</view>
						</view>
						<view class="item">
							<view class="con style2">
								<view><text class="t1">进客户组</text></view>
								<view class="u-m-t-10"><text class="t2">{{sumEnterpriseByType[0].number}}+</text></view>
							</view>
						</view>
						<view class="item">
							<view class="con style2">
								<view><text class="t1">进社区</text></view>
								<view class="u-m-t-10"><text class="t2">28+</text></view>
							</view>
						</view>
						<view class="item">
							<view class="con style1">
								<view><text class="t1">进学校</text></view>
								<view class="u-m-t-10"><text class="t2">{{sumEnterpriseByType[1].number}}+</text></view>
							</view>
						</view>
					</view>
				</view> -->
				<!-- 回收指南 -->
				<!-- <view class="grid-box u-skeleton-fillet">
					<view class="guide">
						<view class="head-title"><text>回收指南</text></view>
						<view class="list-con">
							<view class="item">
								<view class="icon u-skeleton-circle">
									<text class="iconfont icon-shoujixiadan"></text>
								</view>
								<text class="name u-skeleton-rect">手机下单</text>
							</view>
							<u-icon name="arrow-right" class="arrow-ico" color="#999"></u-icon>
							<view class="item">
								<view class="icon u-skeleton-circle">
									<text class="iconfont icon-xiaogeshangmen"></text>
								</view>
								<text class="name u-skeleton-rect">小哥上门</text>
							</view>
							<u-icon name="arrow-right" class="arrow-ico" color="#999"></u-icon>
							<view class="item">
								<view class="icon u-skeleton-circle">
									<text class="iconfont icon-a-shangmenhuishou_huaban1"></text>
								</view>
								<text class="name u-skeleton-rect">上门回收</text>
							</view>
							<u-icon name="arrow-right" class="arrow-ico" color="#999"></u-icon>
							<view class="item">
								<view class="icon u-skeleton-circle">
									<text class="iconfont icon-wanchengjiesuan"></text>
								</view>
								<text class="name u-skeleton-rect">完成结算</text>
							</view>
						</view>
					</view>
				</view> -->
				<!-- 最新动态 -->
				<view class="grid-box u-skeleton-fillet">
					<view class="news">
						<view class="head-title u-m-b-30">
							<text>最新动态</text>
							<navigator url="../news/list/list"><text class="iconfont icon-gengduo more u-font-40"></text>
							</navigator>
						</view>

						<template v-if="news.length > 0">
							<navigator :url="'/pages/news/news?id='+item.id" class="item" v-for="(item,index) in news"
								:key="index">
								<u-image class="u-skeleton-fillet" width="180rpx" height="150rpx" :src="item.coverphoto"></u-image>
								<view class="text-con">
									<view class="title u-skeleton-rect"><text class="text u-line-2">{{item.title}}</text></view>
									<view class="date u-skeleton-rect"><text>{{item.date}}</text></view>
								</view>
							</navigator>
						</template>

						<u-empty v-else text="暂无最新动态" mode="list"></u-empty>
					</view>
				</view>
				<view class="about-bottom u-text-center u-p-t-30 u-p-b-30">
					<view class="text u-tips-color u-m-t-15 u-font-24"><text>青猿回收</text><text v-if="version" class="u-font-20 u-p-l-20">V{{version}}</text></view>
				</view>
				<!-- 邀请返现 -->
				<!-- <navigator class="iv-box" @tap="stop" v-if="webSetting.commissionsetting.user.openentry">
					<image :src="inPng" mode="widthFix" width="140rpx" height="140rpx" style="width: 140rpx;height: 140rpx;">
					</image>
				</navigator> -->
				<!-- <view class="mask-box" v-if="webSetting.commissionsetting.user.openentry">
					<u-mask :show="show" @click="show = false">
						<view class="warp">
							<view class="rect" @tap='stop'>
								<image style="width: 100%;  height: 100%; " :src="bg6" mode="widthFix"></image>
								<view class="btn" @tap.stop="btn">
									<u-icon size="40" color="#ffffff" name="close-circle"></u-icon>
								</view>
							</view>
						</view>
					</u-mask>
				</view> -->
				<!-- bannber右侧二维码 -->
				<view class="code-box" @click="getQrCode">
					<image style="width: 70rpx; height: 70rpx;"
						src="">
					</image>
				</view>
			</view>
		</view>
		<!--引用骨架屏组件-->
		<u-skeleton :loading="loading" :animation="true" bgColor="#f3f4f6" el-color="#ffffff"></u-skeleton>
		<!-- 底部菜单栏 -->
		<common-tabbar :current="0"></common-tabbar>
		
		<!--  -->
		<!-- <view class="mask-box" v-if="webSetting.commissionsetting.user.openentry">
			<u-mask :show="show" @click="show = false">
				<view class="warp">
					<view class="rect" @tap='stop'>
						<image style="width: 100%;  height: 100%; " :src="bg6" mode="widthFix"></image>
						<view class="btn" @tap.stop="btn">
							<u-icon size="40" color="#ffffff" name="close-circle"></u-icon>
						</view>
					</view>
				</view>
			</u-mask>
		</view> -->
		
		<!-- 弹出个人二维码 -->
		<u-popup v-model="showQRcode" mode="center" border-radius="14" :closeable="true">
			<view class="u-p-80">
				<view class="u-text-center u-m-b-30">
					<text class="u-font-32">自送价更高</text>
				</view>
				<u-image
					class="u-flex"
					width="500rpx"
					:src="qrcodeURL"
					mode="widthFix">
				</u-image>
				<view class="u-text-center u-m-t-10 u-m-b-10">
					<text class="u-tips-color">{{userdetail.name}}</text>
				</view>
				<view class="u-text-center u-m-t-30">
					<text class="u-font-32">废品回收后，不支持退回，请知悉。</text>
				</view>
			</view>
		</u-popup>
		
		<!-- 临时海报 -->
		<view class="mask-box">
			<u-mask :show="temporary.show" @click="temporary.show = false">
				<view class="warp">
					<view class="rect" style="height: auto;">
						<u-image style="width: 650rpx" :src="temporary.tempFilePath" mode="widthFix" border-radius="14"></u-image>
						<view class="btn" @click="temporary.show = false">
							<u-icon size="60" color="#ffffff" name="close-circle"></u-icon>
						</view>
					</view>
				</view>
			</u-mask>
		</view>
		
		<!-- 弹出登录方式 -->
		<login-wechat :isWechat="isWechat" @close="closeLogin" @update="updateData"></login-wechat>
		
		<!--  -->
		<u-popup v-model="showTips" mode="center" border-radius="14" :closeable="true">
			<view class="u-p-30 tips-box">
				<view class="title">环保贡献是怎么来的？</view>
				<view class="title">青猿回收：响应政策，助力环保</view>
				<view class="text">我们专注于三个方面，以政策为依托，推动环保事业：</view>
				<view class="list">
					<view class="title text">1、减材料消耗：</view>
					<view class="text">减少新原材料需求，如回收纸张减少树木砍伐，回收塑料减少原油消耗。</view>
				</view>
				<view class="list">
					<view class="title text">2、促碳减排：</view>
					<view class="text">通过回收减少CO2排放，支持国家碳达峰碳中和目标。</view>
				</view>
				<view class="list">
					<view class="title text">3、省填埋空间：</view>
					<view class="text">回收减少垃圾填埋，节约土地资源。青猿回收参考国内外研究，核算了各类可回收物的环保效益。</view>
				</view>
				<view class="text">青猿回收，以国家政策为导向，致力于高效、规范的回收再生服务，为绿色发展贡献力量。</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';

	export default {
		data() {
			return {
				loading: true,
				bannerList:[this.baseURL + '/images/banner.jpg'],
				banner1: this.baseURL + '/banner/banner1.jpg',
				banner3: this.baseURL + '/banner/banner3.jpg',
				showQRcode: false,//二维码
				qrcodeURL: '',
				//图片遮罩
				show: false,
				bg: this.baseURL + '/invite/car.png',
				bg1: this.baseURL + '/invite/dian.png',
				bg5: this.baseURL + '/invite/tui.png',
				bg6: this.baseURL + '/invite/6.png',
				list: [
					'黄**回收旧衣获得20元',
					// '罗**回收旧纸获得10元',
					// '刘**回收旧家电（电视）获得200元',
				],
				news: [{
						noticetype: {
							name: ''
						}
					}
					// {
					// 	img: '/static/images/photo6.jpg',
					// 	title:'闲置物品循环回收利用，他们在社区提倡可持续生活方式',
					// 	desc:'日前，在临汾路街道阳曲路760弄乐龄家园举办的“绿色低碳社区之环保市集”活动现场，居民杨阿姨拿着还很新的吸尘器，换取了环保随行水杯、牙膏及皂液等日用品。',
					// 	date:'2022-10-09 08:41'
					// }
				],
				statistics: {
					weightTotal: '--',
					incomeTotal: '--',
					integralTotal: '--'
				},
				chooseType: [
					{
						icon: '',
						name: '品类1',
						brief: '品类描述'
					},
					{
						icon: '',
						name: '品类2',
						brief: '品类描述'
					},
					{
						icon: '',
						name: '品类3',
						brief: '品类描述'
					},
					{
						icon: '',
						name: '品类4',
						brief: '品类描述'
					}
				],
				menuButtonTop: "44px",
				version: "",
				inPng: this.baseURL + '/invite/in.png',
				// 临时海报
				temporary:{
					show: false,
					url: this.baseURL + '/poster/poster1.jpg',
					tempFilePath: ''
				},
				isWechat: false,
				showTips: false,
				carbonRanking:{
					carbon: 0,
					ranking: []
				},
				sumEnterpriseByType:[
					{"type":"客户组","number":0},
					{"type":"学校","number":0},
					{"type":"环卫","number":0},
					{"type":"机关","number":0}
				]
			}
		},
		computed: {
			...mapState({
				Authorization: state => state.Authorization,
				webSetting: state => state.webSetting,
				userdetail: state => state.userdetail
			}),
			current(){
				return getApp().globalData.current
			}
		},
		onShareAppMessage(res) {
			wx.showShareMenu({
				withShareTicket: true,
				menus: ['shareAppMessage', 'shareTimeline']
			})
			return {
				title: '废品变金元，就要找青猿！'
			}
		},
		onShareTimeline: function() {
			return {
				title: '废品变金元，就要找青猿'
			}
		},
		onLoad() {
			// #ifdef MP-WEIXIN
			let obj = wx.getLaunchOptionsSync()
			console.log('obj.scene',obj.scene)
			if (obj.scene === 1047) {
				//1047	扫描小程序码
				if(this.userdetail.id > 0){
					this.getQrCode()
				}else{
					// this.isWechat = true
				}
			}
			// #endif
			
			/* 因审核问题暂时注释 */
			// 获取海报
			// this.$u.get("/User/GetPromoterPhoto").then(res => {
			// 	this.bg6 = this.fileURL + res.url
			// 	try {
			// 		const value = uni.getStorageSync('storage_key');
			// 		if (value) {
			// 			console.log(value, '判断有值');
			// 			this.show = false
			// 		} else {
			// 			try {
			// 				uni.setStorageSync('storage_key', 'true');
			// 				console.log("判断没有")
			// 				this.show = true
			// 			} catch (e) {
							
			// 			}
			// 		}
			// 	} catch (e) {
					
			// 	}
			// })
			
			// 临时通知海报显示
			uni.downloadFile({
				url: this.temporary.url,
				success: (res) => {
					if (res.statusCode === 200) {
						console.log('下载成功');
						this.temporary.show = true
						this.temporary.tempFilePath = res.tempFilePath
					}
				}
			});
			
			// this.initData()
		},
		onShow() {
			getApp().globalData.current = 0
			// #ifdef MP-WEIXIN
			this.menuButtonTop = wx.getMenuButtonBoundingClientRect().top + 'px'
			this.version = wx.getAccountInfoSync().miniProgram.version
			// #endif
			this.initData()
			
			this.getCarbonRanking()
			// this.getSumEnterpriseByType()
		},
		onReady() {
			setTimeout(()=>{
				this.loading = false
			},500)
		},
		methods: {
			async initData(){
				// this.loading = true
				try {
					console.log('加载banner中...')
					await this.getBanner()
					console.log('加载品类选择列表中...')
					await this.getGoodsType()
					console.log('加载新闻列表中...')
					await this.getNewsList()
					console.log('加载订单滚动列表中...')
					await this.getUserOrderRoll()
					if (this.Authorization != '') {
						console.log('加载顶部信息中...',this.Authorization)
						await this.$store.dispatch('getDetails').then((res)=>{
							this.statistics = {
								weightTotal: res.weighttotal,
								incomeTotal: res.incometotal,
								integralTotal: res.integraltotal
							}
						})
					}else{
						this.statistics = {
							weightTotal: '--',
							incomeTotal: '--',
							integralTotal: '--'
						}
					}
				} catch (err) {
					console.log('页面加载数据异常:',err)
				}
				console.log('全部加载完成...')
				// setTimeout(()=>{
					// this.loading = false
				// },500)
			},
			getCarbonRanking(){
				this.$u.get('/User/Order/CarbonRanking').then((res)=>{
					console.log('减碳量排行榜',res)
					this.carbonRanking.carbon = res.carbon
					// this.carbonRanking.ranking = res.ranking
					let arr = []
					res.ranking.sort((a,b)=>b.carbon - a.carbon).forEach((item,index)=>{
						if(index < 3){
							arr.push(item)
						}
					})
					console.log('arr',arr)
					this.carbonRanking.ranking = arr
				})
			},
			getSumEnterpriseByType(){
				// /User/SumEnterpriseByType    6.0
				// /Enterprise/SumByType        6.1
				this.$u.get('/Enterprise/SumByType').then((res)=>{
					console.log('客户组统计',res)
					this.sumEnterpriseByType = res
				})
			},
			goUnitList(){
				uni.navigateTo({
					url: '/pages/index/unitList/unitList'
				})
			},
			goImgArr(){
				uni.navigateTo({
					url: '/pages/index/waterfall/waterfall'
				})
			},
			formatNumberWithTenThousand(num) {
			    // 检查数字是否有效
			    if (isNaN(num)) {
			        return '--';
			    }
			
			    // 如果数字小于10000，则直接返回原数字
			    if (num < 10000) {
			        return num.toFixed(2).toString();
			    }
			
			    // 计算数值并保留一位小数
			    const value = num / 10000;
			    const formattedValue = value.toFixed(2);
			
			    // 返回格式化的字符串
			    return `${formattedValue}万`;
			},
			closeLogin(val) {
				this.isWechat = val
			},
			updateData(token) {
				console.log('index-updateData',token)
				this.initData()
			},
			getBanner(){
				// 获取banner图
				return this.$u.get('User/ListBanner').then((res)=>{
					res.forEach((item)=>{
						item.image = this.fileURL+item.pic
					})
					this.bannerList = res.filter((item)=>item.state == '已启用').sort((a,b)=>{return a.order - b.order})
				})
			},
			bannerClick(index){
				if(this.userdetail.id > 0){
					// 点击banner图
					let obj = this.bannerList[index]
					// 跳转位置是小程序内还是固定链接，url有值为小程序内，url2有值为固定链接
					if(obj.url){
						uni.navigateTo({
							url: obj.url
						})
					}else{
						uni.navigateTo({
							url: `/pages/link/link?pic2=${obj.pic2}&type2=${obj.type2}&url2=${obj.url2}`
						})
					}
				}else{
					this.isWechat = true
				}
				
				// uni.$tracker.track('bannerClick')
			},
			getQrCode(){
				//二维码
				if(this.userdetail.id > 0){
					this.showQRcode = true
					this.$u.get('/user/myQRCode/').then(data => {
						this.qrcodeURL = data
					})
				}else {
					uni.showModal({
						title: '提示',
						content: '请先登录再查看个人回收码',
						success: (res) => {
							if (res.confirm) {
								this.isWechat = true
							} else if (res.cancel) {
								
							}
						}
					})
				}
			},
			gorecovery() {
				let time = new Date()
				// #ifdef MP-WEIXIN
				wx.reportEvent("home_recycling1", {
					"start_route": 'pages/index/index',
					"end_route": 'pages/apply/apply',
					"type": this.userdetail.type,
					"mobile": this.userdetail.mobile,
					"usename": this.userdetail.name,
				})
				// #endif
			},
			stop() {
				// #ifdef MP-WEIXIN
				wx.reportEvent("home_invite", {
					"type": this.userdetail.type,
					"mobile": this.userdetail.mobile,
					"usename": this.userdetail.name,
				})
				// #endif
				/* 因审核问题暂时注释 */
				// if(this.userdetail.id > 0){
				// 	uni.navigateTo({
				// 		//关闭当前页面，跳转到应用内的某个页面。
				// 		url: '/pages/invite/invite'
				// 	});
				// }else {
				// 	this.isWechat = true
				// }
				
				uni.navigateTo({
					//关闭当前页面，跳转到应用内的某个页面。
					url: '/pages/invite/invite'
				});
			},
			btn() {
				try {
					// uni.removeStorageSync('storage_key');
					this.show = false
				} catch (e) {
					// error
				}
			},
			//跳转到网站列表
			goApply(index) {
				if(index == 0){
					let dateTime
					let yy = new Date().getFullYear()
					let mm = new Date().getMonth() + 1
					let dd = new Date().getDate()
					let hh = new Date().getHours()
					let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() :
						new Date().getMinutes()
					let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() :
						new Date().getSeconds()
					dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
					// #ifdef MP-WEIXIN
					wx.reportEvent("home_recycling", {
						"gotime": dateTime,
						"usename": this.userdetail.name,
						"mobile": this.userdetail.mobile,
						"type": this.userdetail.type,
						"role": "点击上门回收模块进入到回收页面"
					})
					// #endif
					getApp().globalData.applyIndex = 0
				}else{
					// #ifdef MP-WEIXIN
					wx.reportEvent("home_shop", {
						"type": this.userdetail.type,
						"mobile": this.userdetail.mobile,
						"usename": this.userdetail.name,
						"start_route": 'pages/index/index',
						"end_route": '/pages/outlet/outletlist/outletlist',
						"role": "点击首页自送网点跳转"
					})
					// #endif
					getApp().globalData.applyIndex = 1
				}
				uni.switchTab({
					url: '/pages/apply/apply'
				})
			},
			// 获取回收记录
			getUserOrderRoll() {
				return this.$u.get('/Web/Home/UserOrderRoll').then((res) => {
					let datas = res
					datas.forEach((item) => {
						let name = item.name.slice(0, 1) + '**'
						let amount = item.amount.toFixed(2)
						let goods = item.productname.length > 1 ? item.productname[0] + '等' : item.productname[0]
						let time = this.$u.timeFrom(new Date(item.updatedatetime.replaceAll('-', '/')),
							false)

						// this.list.push('['+time+']'+name+'回收'+goods+'获得'+amount+'元')
						this.list.push(name + '回收' + goods + '获得' + amount + '元')
					})
				})
			},
			// 选择回收类
			choose(item) {
				uni.switchTab({
					url: '/pages/apply/apply?tid=' + item.id
				})
			},
			// 获取回收品类
			getGoodsType() {
				return this.$u.get('/Waste/Type/List').then((res) => {
					let arr = res

					arr.forEach((item) => {
						item.choose = false
						item.icon = this.fileURL + item.icon
						item.bigicon = this.fileURL + item.bigicon
						// item.range.unshift({
						// 	id: 0,
						// 	name: '拍照上传'
						// })
						item.on = false
					})

					this.chooseType = arr.slice(0, 4)
				})
			},
			getNewsList() {
				return this.$u.post('/Notice/list', {
					PageIndex: 1,
					PageSize: 3,
					typeName: '最新动态'
				}).then((res) => {
					var list = res.rows;
					list.forEach(item => {
						item.coverphoto = this.fileURL + item.coverphoto
					})

					this.news = list
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tips-box{
		width: 650rpx;
		.title{
			font-size: 32rpx;
			font-weight: bold;
		}
		.list{
			padding-left: 2em;
		}
		.text{
			margin-bottom: 10rpx;
		}
	}
	.paiming-list{
		.item{
			display: flex;
			border-bottom: 1px dashed #f1f1f1;
			margin: 20rpx 0;
			.ico{
				width: 48rpx;
				height: 48rpx;
				margin-right: 10rpx;
			}
			.num{
				font-weight: bold;
				color: $u-color-orange;
			}
		}
	}
	.grid-style-box2{
		// margin: 0 -10rpx;
		padding: 10rpx;
		.item{
			width: 50%;
			display: inline-block;
			.con{
				// background: #666;
				border-radius: 12rpx;
				margin: 10rpx;
				padding: 30rpx 20rpx;
				text-align: center;
				.t1{
					font-size: 32rpx;
				}
				.t2{
					color: $u-color-main;
					font-weight: bold;
					font-size: 36rpx;
				}
			}
			.style1{
				background-color: #d8f5f6;
			}
			.style2{
				background-color: #e1f9f1;
			}
		}
	}
	.grid-style-box{
		display: flex;
		.item{
			flex: 1;
			// width: 80rpx;
			height: 160rpx;
			padding: 20rpx;
			border-radius: 12rpx;
			position: relative;
			.font{
				color: #fff;
			}
			.bold{
				font-weight: bold;
			}
			.grid-img{
				width: 150rpx;
				height: 150rpx;
				position: absolute;
				right: -46rpx;
				bottom: 0;
				opacity: 0.4;
			}
			&.t1{
				background-color: #5ccb8f;
			}
			&.t2{
				background-color: #bdbdff;
			}
			&.t3{
				background-color: #ffbd62;
			}
		}
	}
	
	.code-box{
		position: absolute;
		top: 350rpx;
		right: 20rpx;
		// box-shadow: $u-color-border-shadow;
		// background-color: #fff;
		border-radius: 10rpx;
		padding: 15rpx;
		padding-top: var(--status-bar-height);
	}
	
	.tow-ma {
		// background-color: red;
		width: 70rpx;
		height: 100rpx;
		// border: 1rpx solid green;
		position: absolute;
		left: calc(50% - 35rpx);
		top: -103rpx;
		z-index: 9999;
	}

	.container {
		background-color: #f4f4f5;
		min-height: 100vh;
	}

	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
	}

	.rect {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 720rpx;
		height: 850rpx;
		// background-color: #fff;
		position: relative;
		z-index: 99999999;

		.btn {
			position: absolute;
			z-index: 99999999;
			bottom: -50px;
			opacity: 0.5;
		}
	}

	// 首页头部
	.header {
		// background-color: $u-color-main;
		height: 556rpx;
		margin-bottom: 130rpx;
		/* #ifdef MP-WEIXIN */
		// height: calc(600rpx - 44px + var(--status-bar-height));

		/* #endif */
		.logo-box {
			display: flex;
			align-items: center;
			padding-top: 50rpx;
			padding-left: 50rpx;
			/* #ifdef MP-WEIXIN */
			padding-top: calc(44px + 50rpx + var(--status-bar-height));

			/* #endif */
			.logo {
				width: 94rpx;
				height: 106rpx;

			}

			.text-con {
				margin-left: 10rpx;
				color: #fff;

				.b-font {
					font-size: 40rpx;
				}

				.s-font {
					font-size: 20rpx;
				}
			}
		}

		.point {
			font-size: 28rpx;
			color: #fff;
			margin-top: 25px;
			text-align: center;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.label-box {
			position: relative;
			display: flex;
			background-color: #fff;
			margin: 0 30rpx;
			position: relative;
			top: -70rpx;
			
			border-radius: 24rpx;
			// box-shadow: 0px -36rpx 0 #34ac9ad9;
			box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);

			.item {
				flex: 1;
				text-align: center;
				color: $u-content-color;
				// margin: 0 10rpx;
				padding: 30rpx 0;

				.num {
					color: $u-color-orange;
					font-weight: bold;
				}
			}
			.border-line{
				border-right: 1px solid $u-border-color;
				margin: 30rpx 15rpx;
			}
		}
	}

	// 通知公告
	.notice-bar {
		padding: 0 30rpx;
		margin-top: 30rpx;
		font-size: 24rpx;

		::v-deep .u-type-warning-light-bg {
			background-color: #fff;
			border-radius: 20rpx;
		}
	}

	//站点入口
	.men-box {
		// background-color: #fff;
		margin: 0 30rpx;
		// padding: 30rpx;
		border-radius: 24rpx;
		// margin-top: 61rpx;

		>.dizhi-box {
			display: flex;
			font-size: 25rpx;
			justify-content: space-between;
		}

		.go-box {
			display: flex;

			.l-box {
				position: relative;
				background-color: #fff;
				// margin: 0 30rpx;
				padding: 20rpx;
				border-radius: 24rpx;
				margin-right: 30rpx;
				flex: 1;
				box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);

				// height: 212rpx;
				.zi {
					font-size: 36rpx;
				}

				.zi-two {
					font-size: 23rpx;
					color: #9fa3b0;
				}

				.describe {
					position: absolute;
					font-size: 18rpx;
					color: white;
					background-color: #f1760d;
					top: 18rpx;
					left: 176rpx;
					padding: 7rpx 15rpx;
					border-radius: 18rpx 18rpx 18rpx 3rpx;
				}

				.l-15 {
					left: 106rpx;
				}
			}

			.l-box:nth-child(2) {
				margin-right: 0;
			}

			.flex-r {
				display: flex;
				justify-content: flex-end;
			}

		}

	}

	// 宫格展示
	.grid-box {
		background-color: #fff;
		margin: 0 30rpx;
		padding: 30rpx;
		border-radius: 24rpx;
		margin-top: 30rpx;

		&.mt {
			margin-top: 30rpx;
			padding-top: 0;
		}

		.head-title {
			font-size: 32rpx;
			display: flex;
			justify-content: space-between;

			.more {
				color: $u-tips-color;
			}
		}

		.u-flex {
			flex-direction: row-reverse;
			width: 100%;

			.iconfont {
				font-size: 48rpx;
				margin: 0 28rpx 0 0;
				width: 60rpx;
				text-align: center;
			}

			.text {
				flex: 1;
				height: 80rpx;
				margin-right: 20rpx;

				.t1 {
					font-size: 32rpx;
					margin-bottom: 8rpx;

					.u-line-1 {
						width: 200rpx;
						display: block;
					}
				}

				.t2 {
					font-size: 24rpx;
					color: $u-tips-color;
					min-height: 16px;

					.u-line-1 {
						width: 200rpx;
						display: block;
					}
				}
			}
		}

		.u-btn {
			font-size: 30rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border-radius: 10rpx;
		}
	}

	// 回收指南
	.guide {
		.list-con {
			display: flex;
			padding: 30rpx 0;

			.item {
				flex: 1;
				text-align: center;

				.icon {
					width: 68rpx;
					height: 68rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					margin: 0 auto 10rpx;
					border-radius: 50%;
					background: #ffe8a8;

					.iconfont {
						color: #af9652;
					}
				}

				.arrow-ico {
					color: #666;
				}

				.name {
					font-size: 26rpx;
					margin-top: 10rpx;
				}

				.iconfont {
					// color: #fff;
				}
			}
		}

		.u-btn {
			font-size: 30rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border-radius: 60rpx;
		}
	}

	//最新资讯
	.news {
		.item {
			display: flex;

			.text-con {
				flex: 1;
				margin-left: 20rpx;
				display: flex;
				flex-direction: column;

				.title {
					flex: 1;
					font-size: 28rpx;

					.text {
						width: 430rpx;
					}
				}

				.desc {
					font-size: 24rpx;
					margin: 10rpx 0;
					height: 64rpx;
					overflow: hidden;
					color: $u-content-color;
				}

				.date {
					font-size: 24rpx;
					color: $u-tips-color;
				}
			}
		}

		.item+.item {
			margin-top: 20rpx;
		}
	}

	.iv-box {
		position: fixed;
		bottom: 120px;
		right: 8rpx;
	}
</style>